<!--
*Author：
 *Contact：
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/system/workbusiness/PLAN_WORK_ORDER.js此处编写
 -->
<template>
    <view-grid ref="grid"
               :columns="columns"
               :detail="detail"
               :editFormFields="editFormFields"
               :editFormOptions="editFormOptions"
               :searchFormFields="searchFormFields"
               :searchFormOptions="searchFormOptions"
               :table="table"
               :extend="extend">
    </view-grid>
</template>
<script>
    import extend from "@/extension/system/workbusiness/PLAN_WORK_ORDER.js";
    import { ref, defineComponent } from "vue";
    export default defineComponent({
        setup() {
            const table = ref({
                key: 'Order_Id',
                footer: "Foots",
                cnName: '工单维护',
                name: 'workbusiness/PLAN_WORK_ORDER',
                url: "/PLAN_WORK_ORDER/",
                sortName: "CreateOn"
            });
            const editFormFields = ref({"ProductId":"","WorkCenterId":"","ProductBOMId":"","ProcessRouteId":"","OrderType":"","FatherOrderCode":"","OrderQuantity":"","PlanStart":"","PlanEnd":"","Version":"","ProductionSeqNumber":"","process_Status":"","Status":"","accuracy":"","process_type":"","ErrorMeg":"","IsErrorMeg":"","ProjectCode":"","priority":""});
            const editFormOptions = ref([[{"dataKey":"物料","data":[],"title":"模具&产品","field":"ProductId","type":"select"},
                               {"dataKey":"工作中心","data":[],"title":"工作中心","field":"WorkCenterId","type":"select"},
                               {"dataKey":"产品BOM","data":[],"title":"模具&产品BOM","field":"ProductBOMId","type":"select"},
                               {"dataKey":"工艺路线","data":[],"title":"工艺路线","field":"ProcessRouteId","type":"select"},
                               {"dataKey":"工单类型","data":[],"title":"工单类型","field":"OrderType","type":"select"},
                               {"title":"父工单","field":"FatherOrderCode","type":"text"}],
                              [{"title":"工单数量","field":"OrderQuantity","type":"number"},
                               {"title":"计划开始时间","field":"PlanStart","type":"datetime"},
                               {"title":"计划结束时间","field":"PlanEnd","type":"datetime"},
                               {"title":"版本","field":"Version","type":"text"}],
                              [{"title":"排产序号","field":"ProductionSeqNumber","type":"number"},
                               {"dataKey":"工单生产状态","data":[],"title":"工单生产状态","field":"process_Status","type":"select"},
                               {"dataKey":"工单状态","data":[],"title":"工单状态","field":"Status","type":"select"}],
                              [{"title":"精度","field":"accuracy","type":"decimal"},
                               {"dataKey":"加工类型","data":[],"title":"加工类型","field":"process_type","type":"select"},
                               {"title":"是否生成时异常","field":"IsErrorMeg","type":"switch"},
                               {"title":"sql异常","field":"ErrorMeg","type":"textarea"}],
                              [{"dataKey":"项目所属","data":[],"title":"项目编码","field":"ProjectCode","type":"select"},
                               {"title":"优先等级：1，2，3，4","field":"priority","type":"decimal"}]]);
            const searchFormFields = ref({"OrderCode":"","WorkCenterId":"","ProcessRouteId":"","OrderType":"","processing_machines":"","IsProduction":"","Status":""});
            const searchFormOptions = ref([[{"dataKey":"工单（没有Id）","data":[],"title":"工单号","field":"OrderCode","type":"select"},{"dataKey":"工作中心","data":[],"title":"工作中心","field":"WorkCenterId","type":"select"},{"dataKey":"工艺路线","data":[],"title":"工艺路线","field":"ProcessRouteId","type":"select"},{"dataKey":"工单类型","data":[],"title":"工单类型","field":"OrderType","type":"select"},{"dataKey":"加工机床","data":[],"title":"加工机台","field":"processing_machines","type":"select"},{"dataKey":"排产","data":[],"title":"是否排产","field":"IsProduction","type":"select"},{"dataKey":"工单状态","data":[],"title":"工单状态","field":"Status","type":"select"}]]);
            const columns = ref([{field:'Order_Id',title:'Order_Id',type:'guid',width:110,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'OrderCode',title:'工单号',type:'string',bind:{ key:'工单（没有Id）',data:[]},width:200,align:'left',sort:true},
                       {field:'ProductId',title:'模具&产品',type:'string',bind:{ key:'物料',data:[]},width:140,align:'left'},
                       {field:'WorkCenterId',title:'工作中心',type:'string',bind:{ key:'工作中心',data:[]},width:110,hidden:true,align:'left'},
                       {field:'ProductBOMId',title:'模具&产品BOM',type:'string',bind:{ key:'产品BOM',data:[]},width:110,align:'left'},
                       {field:'ProjectCode',title:'项目编码',type:'string',bind:{ key:'项目所属',data:[]},width:120,align:'left'},
                       {field:'ProcessRouteId',title:'工艺路线',type:'string',bind:{ key:'工艺路线',data:[]},width:110,align:'left'},
                       {field:'OrderType',title:'工单类型',type:'string',bind:{ key:'工单类型',data:[]},width:110,align:'left'},
                       {field:'OrderQuantity',title:'工单数量',type:'decimal',width:110,hidden:true,align:'left'},
                       {field:'work_order_number',title:'工单序号',type:'string',link:true,width:120,align:'left'},
                       {field:'PlanStart',title:'计划开始时间',type:'datetime',width:160,align:'left',sort:true},
                       {field:'PlanEnd',title:'计划结束时间',type:'datetime',width:160,align:'left',sort:true},
                       {field:'TopUpSort',title:'置顶序号',type:'int',width:80,hidden:true,align:'left'},
                       {field:'processing_machines',title:'加工机台',type:'string',bind:{ key:'加工机床',data:[]},width:120,align:'left'},
                       {field:'Version',title:'版本',type:'string',width:110,align:'left'},
                       {field:'ProductionSeqNumber',title:'排产序号',type:'decimal',width:110,align:'left'},
                       {field:'IsProduction',title:'是否排产',type:'string',bind:{ key:'排产',data:[]},width:110,align:'left'},
                       {field:'Description',title:'描述',type:'string',width:220,hidden:true,align:'left'},
                       {field:'process_Status',title:'工单生产状态',type:'int',bind:{ key:'工单生产状态',data:[]},width:120,align:'left'},
                       {field:'Status',title:'工单状态',type:'string',bind:{ key:'工单状态',data:[]},width:110,align:'left'},
                       {field:'priority',title:'优先等级：1，2，3，4',type:'int',width:80,align:'left'},
                       {field:'material_id',title:'材料表id',type:'int',width:80,hidden:true,align:'left'},
                       {field:'processing_grade',title:'粗加工：1，半精加工：3，精加工：5',type:'int',width:80,hidden:true,align:'left'},
                       {field:'length',title:'长度',type:'decimal',width:110,align:'left'},
                       {field:'width',title:'宽度',type:'decimal',width:110,align:'left'},
                       {field:'height',title:'高度',type:'decimal',width:110,align:'left'},
                       {field:'measure_number',title:'打表程序名-DB',type:'string',width:120,align:'left'},
                       {field:'centring_number',title:'分中程序名-FZ',type:'string',width:120,align:'left'},
                       {field:'make_level_number',title:'放平程序名-FP',type:'string',width:120,align:'left'},
                       {field:'accuracy',title:'精度',type:'decimal',width:110,align:'left'},
                       {field:'CreateBy',title:'创建人',type:'string',width:110,hidden:true,align:'left'},
                       {field:'CreateOn',title:'创建时间',type:'datetime',width:150,hidden:true,align:'left',sort:true},
                       {field:'UpdateBy',title:'更新人',type:'string',width:110,hidden:true,align:'left'},
                       {field:'LastUpdateOn',title:'更新时间',type:'datetime',width:150,hidden:true,align:'left',sort:true},
                       {field:'IsDeleted',title:'逻辑删除 0/不删除 1/已删除',type:'bool',width:110,hidden:true,align:'left'},
                       {field:'workpiece_id',title:'工件id(外键)',type:'int',width:80,hidden:true,require:true,align:'left'},
                       {field:'IsActivation',title:'工单激活 1 激活',type:'string',width:110,hidden:true,align:'left'},
                       {field:'IsTopUp',title:'是否置顶',type:'bool',width:110,align:'left'},
                       {field:'process_type',title:'加工类型',type:'string',bind:{ key:'加工类型',data:[]},width:120,align:'left'},
                       {field:'ProcessWeight',title:'加工重量',type:'decimal',width:110,align:'left'},
                       {field:'Img',title:'图',type:'string',width:220,align:'left'},
                       {field:'ExecuteStart',title:'执行开始时间',type:'datetime',width:150,align:'left',sort:true},
                       {field:'ExecuteEnd',title:'执行结束时间',type:'datetime',width:150,align:'left',sort:true},
                       {field:'ExecuteOrderTime',title:'执行时间',type:'int',width:80,align:'left'},
                       {field:'MaterialHardness',title:'工件硬度',type:'decimal',width:110,align:'left'},
                       {field:'TollHardness',title:'刀具硬度',type:'decimal',width:110,align:'left'},
                       {field:'UsedToolCount',title:'使用工具',type:'int',width:80,align:'left'},
                       {field:'UsedToolTotal',title:'使用工具总数',type:'int',width:80,align:'left'},
                       {field:'work_order_id',title:'work_order_id',type:'int',width:80,hidden:true,require:true,align:'left'},
                       {field:'ProcessingTime',title:'累计程序加工时间',type:'decimal',width:110,align:'left'},
                       {field:'ProcessingNumber',title:'加工中序号',type:'decimal',width:110,align:'left'},
                       {field:'ProcessingMaterial',title:'材质类型',type:'string',width:110,align:'left'},
                       {field:'process_precision',title:'材料精度',type:'string',width:120,align:'left'},
                       {field:'HolderType',title:'刀柄类型',type:'string',bind:{ key:'刀柄类型',data:[]},width:120,align:'left'},
                       {field:'RotationalSpeed',title:'转速',type:'decimal',width:110,align:'left'},
                       {field:'FatherOrderCode',title:'父工单',type:'string',width:120,align:'left'},
                       {field:'SubOrderCode',title:'子工单',type:'string',width:120,align:'left'},
                       {field:'ErrorMeg',title:'sql异常',type:'string',width:220,align:'left'},
                       {field:'IsErrorMeg',title:'是否生成时异常',type:'bool',width:110,align:'left'}]);
            const detail = ref({
                cnName: "#detailCnName",
                table: "#detailTable",
                columns: [],
                sortName: "",
                key: ""
            });
            return {
                table,
                extend,
                editFormFields,
                editFormOptions,
                searchFormFields,
                searchFormOptions,
                columns,
                detail,
            };
        },
    });
</script>
